require "rubygems"
require "rake"

def tasks
  Rake.application.instance_eval { @tasks }
end

def current_scope
  Rake.application.instance_eval { @scope.last }
end

def task_defined?(task, ns = current_scope)
  tasks.key?([ns, task].compact.join(":"))
end

def rakecall(task)
  Rake::Task[task].invoke
end
